@extends('admin.layouts.app')
@section('css')
 
   <link href="{{asset('assets/plugins/dropzone/dropzone.css')}}" rel="stylesheet" type="text/css" />
  

@endsection
@section('content')

                        <!-- Page-Title -->
                        <div class="row">
                            <div class="col-sm-12">
                                <h4 class="page-title">平台管理</h4>
                                <ol class="breadcrumb">
                                    <li><a href="#">系统</a></li>
                                    <li><a href="{{url('zadmin/type')}}">商品管理</a></li>
                                    <li class="active">添加秒杀商品</li>
                                </ol>
                            </div>
                        </div>
                        
                        <div class="row">
                        	<div class="col-lg-9">
                        		<div class="card-box">
                            <h2 class="m-t-0 header-title">添加秒杀商品</h2>
                            <hr/>
                             
                              @include('admin.common.error')
                      
                              
                        			<div class="row">
			                        	<div class="col-md-12">
                                  
                     

                 
                  <form class="form-horizontal" role="form" action="{{url('zadmin/sale/save')}}" method="post">
                  <div class="form-group">
                      <label class="col-md-3 control-label">商品</label>
                      <div class="col-md-9">
                          <select  class="form-control" name="product_id" required="" id="product_id" >
                            <option value="">请选择</option>
                            @foreach($products as $p)
                            <option value="{{$p->id}}" data-price="{{$p->price}}" data-title="{{$p->name}}">{{$p->name}}</option>
                            @endforeach
                          </select>
                      </div>
                  </div>
                  <div class="form-group">
                        <label class="col-md-3 control-label">标题</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="title" required="" value="{{old('title')}}" >
                        </div>
                  </div>
                  <div class="form-group">
                        <label class="col-md-3 control-label">秒杀价</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="sale_price" required="" value="{{old('sale_price')}}" >
                        </div>
                  </div>

                  <div class="form-group">
                        <label class="col-md-3 control-label">平日价</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="normal_price" required="" value="{{old('normal_price')}}" >
                        </div>
                  </div>

                  <div class="form-group">
                      <label class="col-md-3 control-label">数量</label>
                      <div class="col-md-9">
                          <input type="text" class="form-control" name="num" required="" value="{{old('num')}}" >
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-md-3 control-label">结束时间</label>
                      <div class="col-md-9">
                          <input type="text" class="form-control" name="end_at" required="" value="{{date('Y-m-d H:i')}}" >
                      </div>
                  </div>

                  <div class="form-group">
                      <label class="col-md-3 control-label">状态</label>
                      <div class="col-md-9">
                          <select class="form-control" name="status">
                            <option value="1">上架</option>
                            <option value="0">下架</option>

                          </select>                     
                        </div>
                  </div>

                  <div class="form-group text-center">
                                                  
                    <button type="submit" class="btn btn-info waves-effect waves-light">保存</button>
                  </div>
                          
                 {{csrf_field()}}

                            
                    </form>                                 
                </div>
               
                                              

                                              

                                              
                                </div>
			                        	
			                        </div>

                             
      
                         
                           
            <hr/>                
          



           
                                              
                                              
                            
        
			                        
                        			
                        		</div>
                                
                            </div> <!-- end col -->

                            
                        </div>
@endsection
                        
                        
                        

                  
            
    @section('modal')        
     
    @endsection        
       

           



    
@section('js')
 <script type="text/javascript" src="/js/plupload/plupload.full.min.js"></script>
<script type="text/javascript">
  



$(document).on('change','#product_id',function(){

    var _this    = $(this);
    var price = _this.find(':selected').data('price');
    $('input[name="normal_price"]').val(price);
    var title = _this.find(':selected').data('title');
    $('input[name="title"]').val(title);
       
   
 });
</script>        
@endsection
    
